#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
const int M = 1e9+7;

int n;
ll x, sum;
ll a[N], s[N];

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        s[i] = s[i-1] + a[i];
    }

    cin >> x;
    ll res = x/s[n]*n, b = x%s[n];

    for (int i = 1; i <= n; i++) {
        if (s[i] > b) {
            res += i;
            break;
        }
    }

    cout << res << endl;
    return 0;
}